package com.tuishan.myapplication;

import android.app.Application;
import android.content.Context;

import com.facebook.common.logging.FLog;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.backends.okhttp3.OkHttpNetworkFetcher;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.core.ImageTranscoderType;
import com.facebook.imagepipeline.core.MemoryChunkType;
import com.facebook.imagepipeline.listener.RequestListener;
import com.facebook.imagepipeline.listener.RequestLoggingListener;
import com.tuishan.myapplication.Servers.OkHttpHelper;

import java.util.HashSet;
import java.util.Set;

/**
 * <pre>
 *     time   : 2021/04/15
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class MyApplication extends Application {

    Boolean IsLogin;

    @Override
    public void onCreate() {
        super.onCreate();
        FrescoInit(this);
    }
    private void FrescoInit(Context context) {
        Set<RequestListener> requestListeners = new HashSet<>();
        requestListeners.add(new RequestLoggingListener());
        ImagePipelineConfig config=   ImagePipelineConfig.newBuilder(context)
                .setMemoryChunkType(MemoryChunkType.BUFFER_MEMORY)
                .setImageTranscoderType(ImageTranscoderType.JAVA_TRANSCODER)
                .setRequestListeners(requestListeners)
                .experiment().setNativeCodeDisabled(true)
                .build();
        Fresco.initialize(this,config);
        FLog.setMinimumLoggingLevel(FLog.VERBOSE);
    }

    public Boolean getLogin() {
        return IsLogin;
    }

    public void setLogin(Boolean login) {
        IsLogin = login;
    }
}
